﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace SystemCore
{
    public static class EnumHelpers
    {
	        public static string GetDescription(this Enum value)
	        {
	            FieldInfo fieldInfo = value.GetType().GetField(value.ToString());
	            DescriptionAttribute attribute = Attribute.GetCustomAttribute(fieldInfo, typeof(DescriptionAttribute)) as DescriptionAttribute;
	            return attribute == null ? value.ToString() : attribute.Description;
	        }
    }
}
